<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/semantic.min.js}">
    </script>
</head>
<body>
<div class="ui container" >
    <div class="ui segment">
        <form class="layui-form" method="post" th:action="@{/tea/exam/correcting/submit}" >
            <h1 class="ui black header" th:each="exam:${exams}" th:if="${exam.getId()==result.getExam_id()}" th:text="'试卷：'+${exam.getName()}" ></h1>
            <h2 class="ui black header" th:text="'学生姓名：'+${result.getStu_name()}"></h2>
            <h3 class="ui blue dividing header" th:text="'老师请注意：每份作业只能批改一次哦'"></h3>
            <input type="hidden" name="exam_name" th:each="exam:${exams}" th:if="${exam.getId()==result.getExam_id()}" th:value="${exam.getName()}">
            <input type="hidden" name="stu_id" th:value="${result.getStu_id()}">
            <input type="hidden" name="stu_name" th:value="${result.getStu_name()}">
            <input type="hidden" name="result_id" th:value="${result.getId()}">

            <div class="inline  fields" th:each="test,iterStat:${contents}">
                <label  class="ui black header" th:text="'第'+${iterStat.index+1}+'题：'+${test.subject}"></label>
                <br>

                <div class="layui-form-item" th:if="${test.getType_id()==1||test.getType_id()==2}">
                    <div class="layui-input-block">
                        <h5 class="ui blue header"   th:text="'A选项：'+${test.answer_a}" ></h5>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1||test.getType_id()==2}">
                    <div class="layui-input-block">
                        <h5 class="ui blue header"   th:text="'B选项：'+${test.answer_b}" ></h5>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1||test.getType_id()==2}">
                    <div class="layui-input-block">
                        <h5 class="ui blue header"   th:text="'C选项：'+${test.answer_c}" ></h5>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1||test.getType_id()==2}">
                    <div class="layui-input-block">
                        <h5 class="ui blue header"   th:text="'D选项：'+${test.answer_d}" ></h5>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.getType_id()==1||test.getType_id()==2}">
                    <div class="layui-input-block">
                        <h5 class="ui red header"   th:text="'作答情况：'+${test.getMyanswer()}" ></h5>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${test.type_id==1}">
                    <label class="layui-form-label">评分：</label>
                    <div class="layui-input-block">
                        <select th:name="${test.id}" lay-verify="required" lay-search="">
                            <option value="0">0分</option>
                            <option value="1">1分</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item" th:if="${test.type_id==2}">
                    <label class="layui-form-label">评分：</label>
                    <div class="layui-input-block">
                        <select th:name="${test.id}" lay-verify="required" lay-search="">
                            <option value="0">0分</option>
                            <option value="1">1分</option>
                            <option value="2">2分</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item" th:if="${test.type_id==4}">
                    <label class="layui-form-label">附图[[${iterStat.index+1}]]</label>
                    <div class="layui-input-block">
                        <img class="ui large image" th:src="@{'https://wk2020.oss-cn-shenzhen.aliyuncs.com/'+${test.getMyimage()}}">
                    </div>
                </div>
                <br>
                <label th:if="${test.getType_id()==3||test.getType_id()==4}" class="ui red header" th:text="'作答情况：'+${test.getMyanswer()}"></label>
                <div class="layui-form-item" th:if="${test.type_id==4||test.getType_id()==3}">
                    <label class="layui-form-label">评分：</label>
                    <div class="layui-input-block">
                        <select th:name="${test.id}" lay-verify="required" lay-search="">
                            <option value="0">0分</option>
                            <option value="1">1分</option>
                            <option value="2">2分</option>
                            <option value="3">3分</option>
                            <option value="4">4分</option>
                            <option value="5">5分</option>
                        </select>
                    </div>
                </div>
<!--                <div class="layui-form-item layui-form-text" th:if="${test.type_id==3||test.type_id==4}">-->
<!--                    <label class="layui-form-label">回答</label>-->
<!--                    <div class="layui-input-block">-->
<!--                                <textarea  th:name="${test.id}"   class="layui-textarea" placeholder="请完成答案">-->
<!--                                </textarea></div>-->
<!--                </div>-->

            </div>
            <br>
            <br>
            <br>
            <button class="ui  blue labeled submit icon button" type="submit" >
                <i class="send icon" > </i>
                提交
            </button>
        </form>
    </div>
</div>
</body>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
</script>
</html>